/*
 * Email Notify
 * Copyright: (C) 2008 by Antonio Nastasi
 * Email: sifcenter (at) gmail.it
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "editappearance.h"

#include <KGlobal>
#include <KStandardDirs>
#include <KDebug>

EditAppearance::EditAppearance( KConfigGroup& generalGroup, QWidget* parent )
  : QWidget( parent )
{
  setupUi( this );
  generalGroup_ = generalGroup;
}



EditAppearance::~EditAppearance()
{
  kDebug() << "DESTROYED";
}



void EditAppearance::loadConfig()
{
  QColor color = generalGroup_.readEntry( "FontColor", QColor( Qt::white ) );
  //animateCheck_->setChecked( generalGroup_->readEntry( "Animate", QVariant().toBool() ) );
  longCaptionRadio_->setChecked( ! generalGroup_.readEntry( "ShortCaption", false ) );
  shortCaptionRadio_->setChecked( generalGroup_.readEntry( "ShortCaption", false ) );
  positionCombo_->setCurrentIndex( generalGroup_.readEntry ( "Position", 0 ) );
  fontSelector_->setFont( generalGroup_.readEntry( "Font", QFont() ) );

  if( color.isValid() )
  {
    fontColor_->setColor( color );
  }
  else
  {
    fontColor_->setColor( Qt::white );
  }
}



void EditAppearance::saveConfig()
{
  // Desktop options
  //generalGroup_->writeEntry( "Animate",  animateCheck_->isChecked() );
  generalGroup_.writeEntry( "ShortCaption",  shortCaptionRadio_->isChecked() );
  generalGroup_.writeEntry( "Position",  positionCombo_->currentIndex () );
  generalGroup_.writeEntry( "Font",  fontSelector_->font () );
  generalGroup_.writeEntry( "FontColor",  fontColor_->color () );
}

#include "editappearance.moc"
